//传入的参数n为压平的层数，默认为1，为Infinity时则压平任意层
let arr = [1,[2,[3]],,,,]
let a1 = arr.flat(Infinity)
console.log(a1)